package com.pro.utils;

import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;


@Component
public class GuavaUtils {
    private Cache<String,Object> tenCacheBuild= CacheBuilder.newBuilder()
            //初始化容量
            .initialCapacity(5)
            //容量最大值
            .maximumSize(100)
            //设置并发数
            .concurrencyLevel(5)
            //设置缓存的过期时间
            .expireAfterWrite(600, TimeUnit.SECONDS)
            .recordStats()
            .build();

    public Cache<String, Object> getTenCacheBuild() {
        return tenCacheBuild;
    }

    public void setTenCacheBuild(Cache<String, Object> tenCacheBuild) {
        this.tenCacheBuild = tenCacheBuild;
    }



}